# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AuthorizedBuyersMarketplace.V1.Model.AuctionPackage do
  @moduledoc """
  Defines a segment of inventory that buyer wants to buy. It's created by buyer and could be shared with multiple buyers.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time the auction package was created.
  *   `creator` (*type:* `String.t`, *default:* `nil`) - Output only. The buyer that created this auction package. Format: `buyers/{buyerAccountId}`
  *   `dealOwnerSeatId` (*type:* `String.t`, *default:* `nil`) - Output only. If set, this field contains the DSP specific seat id set by the media planner account that is considered the owner of this deal. The seat ID is in the calling DSP's namespace.
  *   `description` (*type:* `String.t`, *default:* `nil`) - Output only. A description of the auction package.
  *   `displayName` (*type:* `String.t`, *default:* `nil`) - The display_name assigned to the auction package.
  *   `eligibleSeatIds` (*type:* `list(String.t)`, *default:* `nil`) - Output only. If set, this field identifies a seat that the media planner selected as the owner of this auction package. This is a seat ID in the DSP's namespace that was provided to the media planner.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Immutable. The unique identifier for the auction package. Format: `buyers/{accountId}/auctionPackages/{auctionPackageId}` The auction_package_id part of name is sent in the BidRequest to all RTB bidders and is returned as deal_id by the bidder in the BidResponse.
  *   `subscribedBuyers` (*type:* `list(String.t)`, *default:* `nil`) - Output only. The list of buyers that are subscribed to the AuctionPackage. This field is only populated when calling as a bidder. Format: `buyers/{buyerAccountId}`
  *   `subscribedClients` (*type:* `list(String.t)`, *default:* `nil`) - Output only. When calling as a buyer, the list of clients of the current buyer that are subscribed to the AuctionPackage. When calling as a bidder, the list of clients that are subscribed to the AuctionPackage owned by the bidder or its buyers. Format: `buyers/{buyerAccountId}/clients/{clientAccountId}`
  *   `subscribedMediaPlanners` (*type:* `list(GoogleApi.AuthorizedBuyersMarketplace.V1.Model.MediaPlanner.t)`, *default:* `nil`) - Output only. The list of media planners that are subscribed to the AuctionPackage. This field is only populated when calling as a bidder.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. Time the auction package was last updated. This value is only increased when this auction package is updated but never when a buyer subscribed.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :creator => String.t() | nil,
          :dealOwnerSeatId => String.t() | nil,
          :description => String.t() | nil,
          :displayName => String.t() | nil,
          :eligibleSeatIds => list(String.t()) | nil,
          :name => String.t() | nil,
          :subscribedBuyers => list(String.t()) | nil,
          :subscribedClients => list(String.t()) | nil,
          :subscribedMediaPlanners =>
            list(GoogleApi.AuthorizedBuyersMarketplace.V1.Model.MediaPlanner.t()) | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:creator)
  field(:dealOwnerSeatId)
  field(:description)
  field(:displayName)
  field(:eligibleSeatIds, type: :list)
  field(:name)
  field(:subscribedBuyers, type: :list)
  field(:subscribedClients, type: :list)

  field(:subscribedMediaPlanners,
    as: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.MediaPlanner,
    type: :list
  )

  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.AuctionPackage do
  def decode(value, options) do
    GoogleApi.AuthorizedBuyersMarketplace.V1.Model.AuctionPackage.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AuthorizedBuyersMarketplace.V1.Model.AuctionPackage do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
